/*
 * Virtual file system, astrazione del filesystem virtuale
 */

#ifndef FS_INODE_H
#define FS_INODE_H

#include <klibc/ctype.h>
//#include <system/mod.h>

#define VFS_NODE_TYPE_DIR	1
#define VFS_NODE_TYPE_FILE	2
#define VFS_NODE_TYPE_DCHAR	3
#define VFS_NODE_TYPE_DBLCK	4
#define VFS_NODE_TYPE_DPIPE	5
#define VFS_NODE_TYPE_LINK	6
#define VFS_NODE_TYPE_MOUNT	7

#define VFS_NODE_NAME_LEN	220



typedef struct vfs_node_s
{
	char 		name[VFS_NODE_NAME_LEN];
	uint32_t 	inode_n;
	uint32_t 	type;		
	uint32_t	uid;
	uint32_t	gid;
	
	
	struct vfs_node_s	*fs;
	char				dev_path[VFS_NODE_NAME_LEN];
	
	
	uint32_t			(*read)		(struct vfs_node_s *, char *, uint32_t, uint64_t);
	uint32_t			(*write)	(struct vfs_node_s *, char *, uint32_t, uint64_t);
	void				(*open)		(struct vfs_node_s *);
	void				(*close)	(struct vfs_node_s *);
	uint8_t 			(*readdir)	(struct vfs_node_s *, char *, uint32_t);
	struct vfs_node_s 	*(*finddir)	(struct vfs_node_s *, char *);

	
	struct vfs_node_s	*child;		// Il primo figlio
	struct vfs_node_s	*next;		// Prossimo nodo
	struct vfs_node_s	*prev;		// Precedente
} vfs_node_t;




uint8_t inode_list_del(vfs_node_t **, char *);
uint8_t inode_list_add(vfs_node_t **, vfs_node_t *);
uint8_t inode_list_check(vfs_node_t **, char *);
uint8_t inode_list_clear(vfs_node_t **);

#endif
